package com.haoxin.ai_course.modules.course.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.haoxin.ai_course.modules.course.entity.AcArticle;


/**
 * 文章表
 * 
 * @author xingxiangguo
 * @email bugcn@qq.com
 * @date 2022-06-06 09:44:48
 */
public interface AcArticleMapper  extends BaseMapper<AcArticle> {
	@Insert("insert file_resource (file_id,file_name,file_path) values (#{fileId},#{fileName}, #{filePath})")
	void saveFilePath(@Param("fileId")  String fileId,@Param("fileName") String fileName,@Param("filePath")String filePath);
	@Update("update file_resource set file_url = #{url} where file_id=#{fileId}")
	void updateFilePath(@Param("fileId") String fileId, @Param("url")String url);
	
	@Select("select file_id,file_path,file_name from file_resource where file_url is null")
	List<JSONObject> getUrls();
	@Select("select file_id,file_path,file_name from file_resource where  file_id=#{fileId}")
	List<JSONObject> getFileResourse(@Param("fileId")String fileId);
	
}
